package com.riversoft.weixin.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.filter.CharacterEncodingFilter;

@SpringBootApplication
@ComponentScan({"com.riversoft.weixin","com.icss.regie.weixin","com.icss.regie.file"})
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
        
    @Bean
    public FilterRegistrationBean characterEncoding() {
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
        characterEncodingFilter.setForceEncoding(true);
        characterEncodingFilter.setEncoding("UTF-8");
        registrationBean.setFilter(characterEncodingFilter);
        return registrationBean;
    }
    @Bean
    public FilterRegistrationBean wsdlFiter() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        WsdlFilter ssdlFilter = new WsdlFilter();
        registration.setFilter(ssdlFilter);
        registration.addUrlPatterns("/*");
        registration.setName("wsdlFilter");
        registration.setOrder(2);
        return registration;
    }
}
